package com.ahtcm.tcmlearning.dao;

import com.ahtcm.tcmlearning.model.QuestionRecord;
import org.apache.ibatis.annotations.Param;

import java.util.Date;

public interface QuestionRecordMapper {
    int deleteByPrimaryKey(Integer recordId);

    int insert(QuestionRecord record);

    int insertSelective(QuestionRecord record);

    QuestionRecord selectByPrimaryKey(Integer recordId);

    int updateByPrimaryKeySelective(QuestionRecord record);

    int updateByPrimaryKey(QuestionRecord record);

    /**
     * @description 获取用户章节刷题相应类目进行到哪一题
     * @author yangrongdeng
     * @param categoryId
     * @param userId
     */
    QuestionRecord chapterQuestionRecord(@Param("categoryId") Integer categoryId, @Param("userId") Integer userId);

    /**
     * @description 向用户做题记录表中添加记录
     * @author yangrongdeng
     * @param userId
     * @param questionId
     * @param isRight
     * @param createTime
     * @param isValid
     * @param categoryId
     * @param functionType 功能模块标识，0为按章节刷题,1为记忆斩
     */
    void addQuestionRecord(@Param("userId") Integer userId, @Param("questionId") Integer questionId,
                           @Param("isRight") Integer isRight, @Param("createTime") Date createTime,
                           @Param("isValid") int isValid, @Param("categoryId") Integer categoryId,
                           @Param("functionType") Integer functionType,@Param("contentId")Integer contentId );

    /**
     * @description 记忆斩模块获取用户该模块进度的记录
     * @author yangrongdeng
     * @param functionType
     * @param userId
     * @return
     */
    QuestionRecord findContentIdByQuestionType(@Param("functionType") Integer functionType, @Param("userId") Integer userId);
}